<?php

/**
 * This is the model class for table "{{receivables}}".
 *
 * The followings are the available columns in table '{{receivables}}':
 * @property integer $zre_id
 * @property string $zo_id
 * @property integer $zm_id
 * @property string $zre_account
 * @property double $zre_price
 * @property integer $zpy_id
 * @property integer $zre_admin_id
 * @property integer $zre_status
 * @property string $zre_note
 * @property integer $zre_del
 * @property integer $inputtime
 */
class Receivables extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Receivables the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{receivables}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('zm_id, zre_price, zpy_id, zre_status, inputtime', 'required'),
			array('zm_id, zpy_id, zre_admin_id, zre_status, zre_del, inputtime', 'numerical', 'integerOnly'=>true),
			array('zre_price', 'numerical'),
			array('zo_id', 'length', 'max'=>20),
			array('zre_account', 'length', 'max'=>255),
			array('zre_note', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('zre_id, zo_id, zm_id, zre_account, zre_price, zpy_id, zre_admin_id, zre_status, zre_note, zre_del, inputtime', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'zre_id' => 'Zre',
			'zo_id' => 'Zo',
			'zm_id' => 'Zm',
			'zre_account' => 'Zre Account',
			'zre_price' => 'Zre Price',
			'zpy_id' => 'Zpy',
			'zre_admin_id' => 'Zre Admin',
			'zre_status' => 'Zre Status',
			'zre_note' => 'Zre Note',
			'zre_del' => 'Zre Del',
			'inputtime' => 'Inputtime',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('zre_id',$this->zre_id);
		$criteria->compare('zo_id',$this->zo_id,true);
		$criteria->compare('zm_id',$this->zm_id);
		$criteria->compare('zre_account',$this->zre_account,true);
		$criteria->compare('zre_price',$this->zre_price);
		$criteria->compare('zpy_id',$this->zpy_id);
		$criteria->compare('zre_admin_id',$this->zre_admin_id);
		$criteria->compare('zre_status',$this->zre_status);
		$criteria->compare('zre_note',$this->zre_note,true);
		$criteria->compare('zre_del',$this->zre_del);
		$criteria->compare('inputtime',$this->inputtime);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}